<template>
	<view class="settlementDetails">
		<!-- 用户信息 -->
		<view class="userInfo flex-r-c-c"
			style="background-image: url(https://yft.yangfatang.cn/upload/bg/bg2.png); background-size: 100% 100%;">
			<image :src="detailsData.userimg" mode="widthFix"></image>
			<view class="list_r flex-r-b-c">
				<view class="list_r_l">
					<view class="name">{{detailsData.nickname}}</view>
					<!-- <view class="titleBtn" v-if="pageData.type == 2">{{detailsData.rank}}</view> -->
					<view class="titleBtn">会员</view>
				</view>
			</view>
		</view>
		
		<!-- 详情 -->
		<view class="detailsBox">
			<view class="list">
				<view class="title">付款金额</view>
				<view class="moneyBox">¥ <text>{{ pageData.type == 1 ? detailsData.order_price : detailsData.price}}</text></view>
			</view>
			<view class="list" style="margin-top: 20rpx;">
				<view class="title">订单信息：</view>
				<view class="order_info flex-r-a-c" v-for="(item,index) in detailsData.goods" :key="index">
					<view class="name">{{item.name}}</view>
					<view class="number">X{{ pageData.type == 1 ? item.num : item.gnum }}</view>
					<view class="money">¥ <text>{{item.price}}</text></view>
				</view>
			</view>
			<view v-if="pageData.type == 2" class="list flex-r-b-c" style="height: 88rpx; margin-top: 20rpx; border-bottom: 1px solid #F2F2F2;">
				<view class="title">扣除货款：</view>
				<view class="money" style="color: #000000;">¥ <text>{{detailsData.payment}}</text></view>
			</view>
			<view class="list flex-r-b-c" style="height: 88rpx; margin-top: 20rpx; border-bottom: 1px solid #F2F2F2;">
				<view class="title">{{pageData.type == 1 ? '佣金收益：' : '零售收益：'}}</view>
				<view class="money">¥ <text>{{detailsData.price}}</text></view>
			</view>
			<view class="list flex-r-b-c" style="height: 88rpx; border-bottom: 1px solid #F2F2F2;">
				<view class="title">下单时间：</view>
				<view class="time list_r">{{detailsData.buytime}}</view>
			</view>
			<view class="list flex-r-b-c" style="height: 88rpx;">
				<view class="title">订单编号：</view>
				<view class="orderNum list_r">{{ pageData.type == 1 ? detailsData.orderid : pageData.id}}</view>
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				pageData: null,
				detailsData: {} // 详情
			};
		},
		onLoad(el){
			console.log(el)
			this.pageData = el
			el.type == 1 ? this.getDetailsData(el.id) : this.getAgentSetContent(el.id)
		},
		methods: {
			// 获取代理 未结算 详情
			getAgentSetContent(id){
				console.log(id)
				let that = this
				that.$api.agent_setContent({orderid: id}).then(res => {
					console.log(res)
					that.detailsData = res.data.data
				})
			},
			// 获取详情
			getDetailsData(id){
				let that = this
				that.$api.commission_details({id: id}).then(res => {
					console.log(res)
					that.detailsData = res.data.data
				})
			}
		}
	}
</script>

<style lang="less">
	.settlementDetails {

		.userInfo {
			width: 90vw;
			height: 208rpx;
			margin: 30rpx auto;

			image {
				width: 120rpx;
				height: 120rpx;
				margin-right: 20rpx;
				border-radius: 50%;
			}

			.list_r {
				width: 65%;

				.list_r_l {
					.name {
						font-size: 32rpx;
						font-weight: 500;
						color: #292929;
					}

					.titleBtn {
						width: 120rpx;
						height: 42rpx;
						line-height: 42rpx;
						text-align: center;
						border-radius: 30rpx;
						background: linear-gradient(180deg, #FCD8A0 0%, #EABD6E 100%);
						color: #4B4B4B;
						font-size: 24rpx;
						font-weight: 500;
						margin-top: 10rpx;
					}

					.time {
						font-size: 20rpx;
						font-weight: 500;
						color: #888888;
						margin-top: 10rpx;
					}
				}
			}
		}
		
		.detailsBox{
			width: 88vw;
			height: auto;
			border-radius: 12rpx;
			background-color: #FFFFFF;
			margin: 30rpx auto;
			box-sizing: border-box;
			padding: 30rpx;		
			.list{
				width: 100%;
				.title{
					font-size: 28rpx;
					font-weight: 500;
				}
				.list_r{
					font-size: 24rpx;
					font-weight: 500;
					color: #7C7C7C;
				}
				.money{
					font-size: 24rpx;
					color: #FF6C1D;
					font-weight: 500;
					text{
						display: inline-block;
						font-size: 32rpx;
						margin-left: 10rpx;
					}
				}
				.order_info{
					margin-top: 20rpx;
					font-weight: 500;
					.name{
						color: #6C6C6C;
						font-size: 24rpx;
					}
					.number{
						font-size: 30rpx;
					}
					.money{
						color: #4B4B4B;
						font-size: 24rpx;
						text{
							display: inline-block;
							font-size: 32rpx;
							margin-left: 10rpx;
						}
					}
				}
				.moneyBox{
					width: 100%;
					height: 88rpx;
					line-height: 88rpx;
					background-color: #F5F5F5;
					border-radius: 10rpx;
					font-size: 36rpx;
					color: #FF6C1D;
					box-sizing: border-box;
					padding-left: 20rpx;
					margin-top: 10rpx;
					text{
						display: inline-block;
						font-size: 44rpx;
						margin-left: 10rpx;
					}
				}
			}
		}
		
		
		
		
	}
</style>
